package com.vcc.service.boss.response.userCard;

import cn.dev33.satoken.stp.StpUtil;
import com.vcc.service.boss.response.baseVo.BossBaseVo;
import com.vcc.core.util.DateUtil;
import com.vcc.core.util.StringUtil;
import com.vcc.data.entity.UserCard;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

import java.io.Serializable;
import java.math.BigDecimal;

@EqualsAndHashCode(callSuper = true)
@Data
@Getter
@Setter
public class UserCardVoBoss extends BossBaseVo implements Serializable {
    /**
     * 账号
     */
    private String cardNumber;

    private String cardNumberLastFour;

    private String requestDate;

    private String orderId;

    private Long cardId;

    private Long userId;

    private String account;

    private String channelCode;

    private String currencyCode;

    private String currencyName;

    private String cardType;

    private BigDecimal usableQuota;

    private String remark;

    private String cardStatus;

    private Integer sumCount;

    private Integer successCount;

    private Integer errorCount;

    private BigDecimal sumAmount;

    private BigDecimal successAmount;

    private BigDecimal errorAmount;

    private Integer verifyOpenCardStatus;

    private Integer verifyRechargeCardStatus;

    private Integer verifyOutCardStatus;

    private Integer verifyCloseCardStatus;

    private Integer verifyFreezeUnFreezeCardStatus;

    private BigDecimal exchangeRate;

    private Long cardholderId;

    private String firstName;

    private String lastName;

    public UserCardVoBoss() {
    }

    public UserCardVoBoss(UserCard userCard) {
        super.setId(userCard.getId());
        this.cardNumber = StringUtil.hideCardNumber(userCard.getCardNumber());
        this.requestDate = DateUtil.format(userCard.getRequestDate());
        this.cardId = userCard.getCardTypeId();
        this.userId = userCard.getUserId();
        this.account = userCard.getAccount();
        this.channelCode = userCard.getChannelCode();
        this.currencyCode = userCard.getCurrencyCode();
        this.currencyName = userCard.getCurrencyName();
        this.cardType = userCard.getCardType();
        this.usableQuota = userCard.getUsableQuota();
        this.remark = userCard.getRemark();
        this.cardStatus = userCard.getCardStatus();
        this.sumCount = userCard.getSumCount();
        this.successCount = userCard.getSuccessCount();
        this.errorCount = userCard.getErrorCount();
        this.sumAmount = userCard.getSumAmount();
        this.successAmount = userCard.getSuccessAmount();
        this.errorAmount = userCard.getErrorAmount();
        this.verifyOpenCardStatus = userCard.getUserCardWallet().getVerifyOpenCardStatus();
        this.verifyRechargeCardStatus = userCard.getUserCardWallet().getVerifyRechargeCardStatus();
        this.verifyOutCardStatus = userCard.getUserCardWallet().getVerifyOutCardStatus();
        this.verifyCloseCardStatus = userCard.getUserCardWallet().getVerifyCloseCardStatus();
        this.verifyFreezeUnFreezeCardStatus = userCard.getUserCardWallet().getVerifyFreezeUnFreezeCardStatus();
        this.exchangeRate = userCard.getUserCardWallet().getExchangeRate();
        this.firstName = userCard.getFirstName();
        this.lastName = userCard.getLastName();
        if (!StpUtil.hasPermission("channel:view")) {
            this.setChannelCode("");
        }
        this.cardholderId = userCard.getCardholderId();
    }


}
